package com.paradogs.login.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnComment;
import com.gitee.sunchenbin.mybatis.actable.annotation.DefaultValue;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsAutoIncrement;
import com.gitee.sunchenbin.mybatis.actable.annotation.Unique;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @author: yumi
 * @date: 2024/3/28  14:14
 * @Description: 账号
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@TableName(value = "g_account", autoResultMap = true)
public class Account {

    @IsAutoIncrement
    @TableId(value = "uid", type = IdType.AUTO)
    private Long uid;

    @Unique
    @TableField("account")
    private String account;

    @TableField("password")
    private String password;

    @TableField("login_time")
    private LocalDateTime loginTime;

    @TableField("last_login_time")
    private LocalDateTime lastLoginTime;

    @TableField("register_time")
    private LocalDateTime registerTime;

    @DefaultValue("0")
    @ColumnComment("是否是GM 1是 0否")
    @TableField("is_gm")
    private Boolean isGM;

    @DefaultValue("ON")
    @ColumnComment("账号状态 ON正常 OFF禁用")
    @TableField("status")
    private String status;

    public Account(String account, String password) {
        this.account = account;
        this.password = password;
        this.registerTime = LocalDateTime.now();
    }
}
